<?php $contents = $pager->getResults(); ?>
<?php $j = 0;?>
<?php $structure = $section->getStructure(); ?>

<?php for ($i = 0; $i < strlen($structure); $i++): ?>
    <?php if(strcasecmp(substr($structure, $i, 1),'c') == 0): ?>
        <?php if($contents->count()): ?>
            <?php $content = $contents->getFirst(); ?>
            <?php include_partial('renderSectionNewsContent',
                    array(
                        'content' => $content,
                        'portal' => $portal,
                        'hasBigScreen' => $hasBigScreen
                    ))?>
            <?php $contents->remove($j);  $j++; ?>
            <?php if($i != strlen($structure)-1): ?>
                <hr class="separator">
            <?php endif; ?>
        <?php endif;?>
    <?php elseif(strcasecmp(substr($structure, $i, 1),'e') == 0): ?>
        <?php include_partial('render'.$elements[$i+1]->getType()->getType(),
                array(
                    strtolower($elements[$i+1]->getType()->getType()) => $elements[$i+1],
                    'portal' => $portal,
                    'hasBigScreen' => $hasBigScreen
                ))?>
        <?php if($i != strlen($structure)-1 && $contents->count()): ?>
            <hr class="separator">
        <?php endif; ?>
    <?php endif; ?>
<?php endfor;?>
<?php if ($pager->haveToPaginate()): ?>
    <div class="pagination-desc">
        <strong><?php echo count($pager) ?></strong> Noticias
        <?php if ($pager->haveToPaginate()): ?>
            - pagina <strong><?php echo $pager->getPage() ?>/<?php echo $pager->getLastPage() ?></strong>
        <?php endif; ?>
    </div>
    <div class="pagination">
        <a href="<?php echo url_for('render_section',$section) ?>?page=1">
            <img src="/uploads/default/first.png" alt="1ra página" title="1ra página" />
        </a>
        <a href="<?php echo url_for('render_section', $section) ?>?page=<?php echo $pager->getPreviousPage() ?>">
            <img src="/uploads/default/previous.png" alt="Página anterior" title="Página anterior" />
        </a>
        <?php foreach ($pager->getLinks() as $page): ?>
            <?php if ($page == $pager->getPage()): ?>
                <strong><?php echo $page ?></strong>
            <?php else: ?>
                <a href="<?php echo url_for('render_section', $section) ?>?page=<?php echo $page ?>"><?php echo $page ?></a>
            <?php endif; ?>
        <?php endforeach; ?>
        <a href="<?php echo url_for('render_section', $section) ?>?page=<?php echo $pager->getNextPage() ?>">
            <img src="/uploads/default/next.png" alt="Página siguiente" title="Página siguiente" />
        </a>
        <a href="<?php echo url_for('render_section', $section) ?>?page=<?php echo $pager->getLastPage() ?>">
            <img src="/uploads/default/last.png" alt="Ultima página" title="Last page" />
        </a>
    </div>
<?php endif; ?>